#include "tcpci_core.h"
#include "tcpci.h"
#include "tcpci_event.h"
#include "tcpci_timer.h"
#include "tcpm.h"
#include "pd_core.h"

#undef LOG_TAG
#define LOG_TAG "tcpci_core"
#include "elog.h"

void tcpc_device_register(void)
{
    tcpci_set_low_rp_duty(p_tcpc_dev, true);
    tcpci_timer_init(p_tcpc_dev);
    pd_core_init();
}

static inline void tcpc_device_irq_enable(void)
{
    tcpci_init(p_tcpc_dev, false);
#if TYPE_C_IMPLEMENTS_TRY_SNK
    tcpc_typec_init(p_tcpc_dev, TYPEC_ROLE_TRY_SNK);
#else
    log_a("only support try_snk!\n");
#endif
    tcpci_set_rx_enable(p_tcpc_dev, true); //receive detect 1:SOP
    tcpci_event_init_work(p_tcpc_dev);
}

void tcpc_schedule_init_work(void)
{
    tcpc_device_irq_enable();
}

